<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>案件输入内容</title>
  </head>
  <body>
    <input type="search" />
    <script>
      var searchbar = document.querySelector("input");
      //重点是用keyup触发，如果用keydown，就会吧s也输进去
      document.addEventListener("keyup", function (e) {
        if (e.key === "s") {
          searchbar.focus();
          searchbar.value = "";
        }
      });
    </script>
  </body>
</html>
